import * as TYPES from "../action-types";
import { Map } from "immutable";
let initState = Map({
  currentSong: {}, //单首歌曲信息 --当前歌曲
  playList: [], //播放列表,
  currentSongIndex: 0, //当前歌曲在播放列表索引
  sequence: 0, //0:循环 1 ： 随机 2：单曲 播放
  lyricList: [],
  lyricIdX: 0,
  simiPlayList:[],
  simiSongList:[]
});
function play(state = initState, action) {
  const { type, payload } = action;
  switch (type) {
    case TYPES.CHANGE_CURRENT_SONG:
      return state.set("currentSong", payload);

    case TYPES.CHANGE_PLAY_LIST:
      return state.set("playList", payload);

    case TYPES.CHANGE_CURRENT_SONG_INDEX:
      return state.set("currentSongIndex", payload);

    case TYPES.CHANGE_SEQUENCE:
      return state.set("sequence", payload);
    case TYPES.CHANGE_LYRIC_LIST:
      return state.set("lyricList", payload);
      case TYPES.CHANGE_CURRENT_LYRIC_INDEX:
        return state.set("lyricIdX", payload);

        case TYPES.SIMI_PLAY_LIST:
          return state.set("simiPlayList", payload);
          case TYPES.SIMI_SONG:
            return state.set("simiSongList", payload);
  
    default:
      return state;
  }
}

export default play;
